package org.casaca.checkbackup.core.checksum;

import org.casaca.checkbackup.core.exception.ChecksumResetException;

public abstract class Checksum {
	
	private String name, shortname;
	
	public Checksum(String name, String shortname){
		if(name==null && shortname==null)
			throw new IllegalArgumentException("Arguments must not be null");
		
		this.name = name;
		this.shortname = shortname;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getShortname() {
		return shortname;
	}

	public void setShortname(String shortname) {
		this.shortname = shortname;
	}
	
	public abstract String getChecksumType();

	public abstract void addSlice(byte[] b, int offset, int len);
	
	public abstract void complete();
	
	public abstract String getChecksum();
	
	public abstract void reset() throws ChecksumResetException;
}
